//------------国检状态.
	function changeGjStatuName(value){
		
		changeJyBaseStatusName(value,'jyjyStateInput');
	}
	
	
	
	function changeHgStatuName(value){
		
		changeHGBaseStatusName(value,'hgStateInput');
	}
	
	function getHgStateName(value){
		var result ="";
		if(value){
			value = Number(value);
			
			switch(value){
			case 1: result = '上载中';break;
			case 2: result = '上载成功';break;
			case 3: result = '上载失败';break;
			case 4: result = '暂存';break;
			case 5: result = '申报失败';break;
			case 6: result = '申报中';break;
			case 8: result = '申报成功';break;
			case 12: result = '担保放行';break;
			case 16: result = '报关单审结';break;
			case 18: result = '需交税费';break;
			case 20: result = '海关删单';break;
			case 21: result = '报关单重审';break;
			case 22: result = '结关';break;
			case 23: result = '查验通知';break;
			case 25: result = '报关单放行';break;
			case 27: result = '进港回执';break;
			}
		}
		return result;
	}
	
	function changeHGBaseStatusName(value,idName) {
		var result = getHgStateName(value);
		//$("#"+idName).html(result);
		$("#"+idName).attr("value",result);
	}
	function changeHGstatusHtml(value,idName) {
		var result = getHgStateName(value);
		$("#"+idName).html(result);
	}
	
	//1-申报中；2-申报成功；3-申报失败；4-暂存；5-报检成功；6-报检失败；7-审核成功；8-放行成功；9-审批不通过；10-不予放行
	
	function getJyStatusName(value){
		var result ="";
		if(value){
			value = Number(value);
			
			switch(value){
			case 1: result = '申报中';break;
			case 2: result = '申报成功';break;
			case 3: result = '申报失败';break;
			case 4: result = '暂存';break;
			case 5: result = '报检成功';break;
			case 6: result = '报检失败';break;
			case 7: result = '审核成功';break;
			case 8: result = '放行成功';break;
			case 9: result = '审批不通过';break;
			case 10: result = '不予放行';break;
			}
		}
		return result;
	}
	function changeJyBaseStatusName(value,idName) {
		var result =getJyStatusName(value);
		
		//$("#"+idName).html(result);
		$("#"+idName).attr("value",result);
	}
	
	function changeJyStatusHtml(value,idName){
		var result =getJyStatusName(value);
	
		$("#"+idName).html(result);
	}

	
	function linkTab( url , gjh){
		var param = getTabParam( url );
		var tabid = param[0]+gjh;
		var tabName = param[0];
		if(gjh && gjh !="" ){
			tabName = tabName +":"+gjh;
		}
		parent.addTab2(url,tabid,tabName,param[1],gjh);
	}
	
	function getTabParam( url){
		var result = new Array();
		result[0] = "新建页面";
		result[1] = "6";
		if(url.indexOf("entryInspect_inspect.do") > -1){
			result[0] = "进境报检数据录入";
			result[1] = "2";
		}else if(url.indexOf("entryDeclare_customs.do") > -1){
			result[0] = "进口报关数据录入";
			result[1] = "1";
		}else if(url.indexOf("entryDeclareAndInspect_query.do") > -1){
			result[0] = "进口关检数据录入";
			result[1] = "0";
		}else if(url.indexOf("exportInspect_exportInspect.do") > -1){
			result[0] = "出境报检数据录入";
			result[1] = "5";
		}else if(url.indexOf("exportDeclare_customs.do") > -1){
			result[0] = "出口报关数据录入";
			result[1] = "4";
		}else if(url.indexOf("exportDeclareAndInspect_query.do") > -1){
			result[0] = "出口关检数据录入";
			result[1] = "3";
		}else if( url.indexOf("entryInspect_queryById") > -1 ||    url.indexOf("entryInspect_queryByGjhAndGjglmm.do") > -1){
			result[0] = "进境报检数据";
			result[1] = "2";
		}else if( url.indexOf("entryDeclare_queryById.do") > -1    || url.indexOf("entryDeclare_queryByGjhAndGjglmm.do") > -1){
			result[0] = "进口报关数据";
			result[1] = "1";
		}else if( url.indexOf("exportInspect_queryById.do") > -1 || url.indexOf("exportInspect_queryByGjhAndGjglmm.do") > -1){
			result[0] = "出境报检数据";
			result[1] = "5";
		}else if(url.indexOf("exportDeclare_queryById.do") > -1    || url.indexOf("exportDeclare_queryByGjhAndGjglmm.do") > -1){
			result[0] = "出口报关数据";
			result[1] = "4";
		}else if(url.indexOf("dataQuery_queryBygjh.do?flag=import") > -1){
			result[0] = "进口关检数据";
			result[1] = "0";
		}else if(url.indexOf("dataQuery_queryBygjh.do?flag=export") > -1){
			result[0] = "出口关检数据";
			result[1] = "3";
		}else if(url.indexOf("dataQuery_queryReceivequeue.do") > -1){
			result[0] = "报关回执";
			result[1] = "6";
		}else if(url.indexOf("dataQuery_queryReceiptRecord.do") > -1){
			result[0] = "报检回执";
			result[1] = "6";
		}
		
		return result;
	}

	
	function resetIframe(gjglh){
		
		var frameId = $(window.frameElement).attr("id");
		var headFlag = frameId.substring(0,6);
		var framName = $(window.frameElement).attr("name");
		var tab = $("#"+framName, window.parent.document);
		var newFrameName ;
		var newFrameId;
		var newTabId;
		var newTabHtml;
		var sameTabIndex ="";
			 newFrameName = headFlag+gjglh;
			 newFrameId = newFrameName+"_content";
			 var sameTabCount = $("iframe[id^='"+newFrameName+"'][id$='_content'][id!='"+frameId+"']", window.parent.document).length;
			 if( sameTabCount > 0 ){
				 sameTabIndex = "_"+sameTabCount;
			 }
			 newTabId =  headFlag+gjglh;
			 if(gjglh.length == 16){
				 newTabHtml =  headFlag+":"+gjglh;
			 }else{
				 newTabHtml = headFlag+gjglh;
			 }
			 
		$(window.frameElement).attr("name",newFrameName+sameTabIndex);
		$(window.frameElement).attr("id",newFrameName+sameTabIndex+"_content");
		tab.attr("id",newTabId+sameTabIndex);
		tab.html(newTabHtml+sameTabIndex);
		
	}
